

'''
将脚本快捷方式放到开机启动文件夹
'''
import getpass
import os
import winshell  
a=getpass.getuser()
#获取用户名
def main():  
    destDir = 'C:\\Users\\' + a + '\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup'
    filename = "自动关机"  
    target = r'./auto_shutdown.pyw' 
  
    winshell.CreateShortcut(  
        Path = os.path.join(destDir, os.path.basename(filename)+".lnk"),  
        Target = target,  
        Icon = (target, 0),  
        Description = "shortcut test")  
  
if __name__ == "__main__":  
    main()  
